package com.applink.sell_proof.model;

import java.util.List;

public class Sell {

	private long Id = -1;
	private long Code = -1;
	private String InvoceNumber;
	private String RewardCode;
	private String Image;
	private String DistributorInvoiceNumber;
	private long InvoiceDate;
	private long DistributorId;
	private List<Product> mProducts;
	private STAGE stage;

	public List<Product> getProducts() {
		return mProducts;
	}

	public void setProducts(List<Product> products) {
		mProducts = products;
	}

	public long getDistributorId() {
		return DistributorId;
	}

	public void setDistributorId(long distributorId) {
		DistributorId = distributorId;
	}

	public long getId() {
		return Id;
	}

	public void setId(long id) {
		Id = id;
	}

	public long getCode() {
		return Code;
	}

	public void setCode(long code) {
		Code = code;
	}

	public String getInvoceNumber() {
		return InvoceNumber;
	}

	public void setInvoceNumber(String invoceNumber) {
		InvoceNumber = invoceNumber;
	}

	public String getRewardCode() {
		return RewardCode;
	}

	public void setRewardCode(String rewardCode) {
		RewardCode = rewardCode;
	}

	public String getImage() {
		return Image;
	}

	public void setImage(String image) {
		Image = image;
	}

	public String getDistributorInvoiceNumber() {
		return DistributorInvoiceNumber;
	}

	public void setDistributorInvoiceNumber(String distributorInvoiceNumber) {
		DistributorInvoiceNumber = distributorInvoiceNumber;
	}

	public long getInvoiceDate() {
		return InvoiceDate;
	}

	public void setInvoiceDate(long invoiceDate) {
		InvoiceDate = invoiceDate;
	}

	public STAGE getStage() {
		return stage;
	}

	public void setStage(STAGE stage) {
		this.stage = stage;
	}

	public static enum STAGE {
		DRAFT(15), SUBMITTED(9), VALIDATE_SUCCESSFUL(11), VALIDATE_FAILED(12);
		private final int stage;

		private STAGE(int stage) {
			this.stage = stage;
		}

		@Override
		public String toString() {
			switch (stage) {
			case 15:
				return "Draft";
			case 9:
			case 10:
			case 16:
				return "Submitted";
			case 11:
				return "Successful Validation";
			case 12:
				return "Failed Validation";
			default:
				break;
			}
			return null;
		}

		public static STAGE getStage(int stage) {
			switch (stage) {
			case 15:
				return DRAFT;
			case 9:
			case 10:
			case 16: // updated
				return SUBMITTED;
			case 11:
				return VALIDATE_SUCCESSFUL;
			case 12:
				return VALIDATE_FAILED;
			default:
				break;
			}
			return null;
		}

		public int toInt() {
			return stage;
		}

		public int getIconResource() {
			switch (stage) {
			case 15:
				return com.applink.sell_proof.R.drawable.deal_draft;
			case 9:
			case 10:
			case 16:
				return com.applink.sell_proof.R.drawable.deal_submitted;
			case 11:
				return com.applink.sell_proof.R.drawable.deal_validated;
			case 12:
				return com.applink.sell_proof.R.drawable.deal_validated;
			default:
				break;
			}
			return 0;
		}
	}

}
